<?php

namespace App\Services\Wechat;

use EasyWeChat\Factory;

class MiniProgramService
{
    private function __construct()
    {
    }

    public static function getInstance($plat = 'garage')
    {
        $conf = config('wechat.miniprogram')[$plat ?? 'garage'];
        $config = [
            'app_id' => $conf['app_id'],
            'secret' => $conf['secret'],
            'response_type' => 'array',
            'log' => [
                'level' => 'debug',
                'file' => MY_LOG_PATH . '/wechat.log',
            ],
        ];
       
        $app = Factory::miniProgram($config);
        return $app;
    }

    private function __clone()
    {
    }
}
